﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using BranchOfSansar.Sansar.Enquiry;
using BranchOfSansar.Register.Trans;
using BranchOfSansar.Sansar.Transfer;

namespace BranchOfSansar.Register.Main
{
    public partial class frmUtm : DevExpress.XtraEditors.XtraForm
    {
        public frmUtm()
        {
            InitializeComponent();
        }

        private void btnSearch_Click(object sender, EventArgs e)
        {
            FillGrid();
        }
        private void FillGrid()
        {
            using (EnquiryClient obj = new EnquiryClient(Globals.Token))
            {
                gridTransaction.DataSource = obj.GetUtmTxnList(txtDate.DateTime);
                //dataGridView1.DataSource = obj.GetUtmTxnList(txtDate.DateTime);
            }
        }
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            DateTime dt = Globals.GetDate();
            if (dt.ToString("yyyyMMdd") != txtDate.DateTime.ToString("yyyyMMdd"))
            {
                if (Globals.Question("Guilgee oruulah ognoo systemiin ognoonoos zorj bna! Guilgeeg oruulah uu?") == System.Windows.Forms.DialogResult.No)
                    return;
            }
            using (TransferClient obj = new TransferClient(Globals.Token))
            {
                Globals.Info((obj.DoUtmTxns(txtDate.DateTime)).Message);
            }
            FillGrid();
        }
    }
}